﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test</title>
    <link rel="stylesheet" type="text/css" href="../common/qunit.css" />
    <script type="text/javascript" src="../common/jquery.js"></script>
    <script type="text/javascript" src="../common/qunit.js"></script>
    <script type="text/javascript">

        function demoExplictExpect() {
            expect(2);

            function calc(x, operation) {
                return operation(x);
            }

            var result = calc(2, function (x) {
                ok(true, "calc() calls operation function");
                return x * x;
            });

            equal(result, 4, "2 square equals 4");
        }

        function demoExpectByPassArgument() {
            function calc(x, operation) {
                return operation(x);
            }

            var result = calc(2, function (x) {
                ok(true, "calc() calls operation function");
                return x * x;
            });

            equal(result, 4, "2 square equals 4");
        }

    </script>
</head>
<body>
    <h1 id="qunit-header">
        Demonstration</h1>
    <h2 id="qunit-banner">
    </h2>
    <div id="qunit-testrunner-toolbar">
    </div>
    <h2 id="qunit-userAgent">
    </h2>
    <ol id="qunit-tests">
    </ol>
    <div id="qunit-fixture">
        test markup, will be hidden</div>
    <script type="text/javascript">
        test("explictly called 'expect' in the test method", demoExplictExpect);
        test("passing expect number by parameter", 2, demoExpectByPassArgument);
    </script>
</body>
</html>
